{{- if .Values.cloudProviderYandex.internal.providerDiscoveryData.monitoringAPIKey }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: cloud-metrics-exporter
  namespace: d8-cloud-provider-yandex
  {{- include "helm_lib_module_labels" (list . (dict "app" "cloud-metrics-exporter")) | nindent 2 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: d8:cloud-provider-yandex:cloud-metrics-exporter:d8-rbac-proxy
  {{- include "helm_lib_module_labels" (list . (dict "app" "cloud-metrics-exporter")) | nindent 2 }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: d8:rbac-proxy
subjects:
  - kind: ServiceAccount
    name: cloud-metrics-exporter
    namespace: d8-cloud-provider-yandex
{{- end }}
